# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Docs.V1.Model.CropProperties do
  @moduledoc """
  The crop properties of an image. The crop rectangle is represented using fractional offsets from the original content's 4 edges. - If the offset is in the interval (0, 1), the corresponding edge of crop rectangle is positioned inside of the image's original bounding rectangle. - If the offset is negative or greater than 1, the corresponding edge of crop rectangle is positioned outside of the image's original bounding rectangle. - If all offsets and rotation angles are 0, the image is not cropped.

  ## Attributes

  *   `angle` (*type:* `number()`, *default:* `nil`) - The clockwise rotation angle of the crop rectangle around its center, in radians. Rotation is applied after the offsets.
  *   `offsetBottom` (*type:* `number()`, *default:* `nil`) - The offset specifies how far inwards the bottom edge of the crop rectangle is from the bottom edge of the original content as a fraction of the original content's height.
  *   `offsetLeft` (*type:* `number()`, *default:* `nil`) - The offset specifies how far inwards the left edge of the crop rectangle is from the left edge of the original content as a fraction of the original content's width.
  *   `offsetRight` (*type:* `number()`, *default:* `nil`) - The offset specifies how far inwards the right edge of the crop rectangle is from the right edge of the original content as a fraction of the original content's width.
  *   `offsetTop` (*type:* `number()`, *default:* `nil`) - The offset specifies how far inwards the top edge of the crop rectangle is from the top edge of the original content as a fraction of the original content's height.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :angle => number() | nil,
          :offsetBottom => number() | nil,
          :offsetLeft => number() | nil,
          :offsetRight => number() | nil,
          :offsetTop => number() | nil
        }

  field(:angle)
  field(:offsetBottom)
  field(:offsetLeft)
  field(:offsetRight)
  field(:offsetTop)
end

defimpl Poison.Decoder, for: GoogleApi.Docs.V1.Model.CropProperties do
  def decode(value, options) do
    GoogleApi.Docs.V1.Model.CropProperties.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Docs.V1.Model.CropProperties do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
